<%@taglib uri="/WEB-INF/struts-html.tld"  prefix="html"%>
<%@taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@taglib uri="/WEB-INF/struts-bean.tld"  prefix="bean"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<html:form action="user.do?action=userAdd">
    <table cellpadding="1" cellspacing="1" width="100%">
        <tr class="netral">
            <td colspan="2"><bean:message key="user.user"/></td>
        </tr>
        <tr class="form">
            <td><bean:message key="user.userName"/></td>
            <td>: <html:text property="userName" size="35"/></td>
        </tr>
        <tr class="form">
            <td><bean:message key="user.password"/></td>
            <td>: <html:password property="password" size="35"/></td>
        </tr>
        <tr class="form">
            <td><bean:message key="user.nama"/></td>
            <td>: <html:text property="nama" size="70"/></td>
        </tr>
        <tr class="form">
            <td><bean:message key="user.departement"/></td>
            <td>:
                <html:select property="departement">
                    <logic:iterate id="listDepartement" name="listDepartement">
                        <option value="<bean:write name="listDepartement" property="id"/>"><bean:write name="listDepartement" property="namaBagian"/></option>
                    </logic:iterate>
                </html:select>
            </td>
        </tr>
        <tr class="form">
            <td colspan="3" align="right"><input type="button" onclick="validate_form()" value="${buttonAdd}"/></td>
        </tr>
    </table>
</html:form>
<!--<html:form action="user">
    <table cellpadding="1" cellspacing="1" width="100%">
        <tr>
        <td><html:text property="search" size="100"/><html:submit><bean:message key="label.search"/></html:submit><html:hidden property="action" value="userSearch"/></td>
        </tr>
    </table>
</html:form>-->
<!--p><a href="javascript:showForm();" class="noLink"><bean:message key="label.search"/> <bean:message key="user.user"/></a></p>
<span id="formSearch"></span-->
<table cellpadding="1" cellspacing="1" width="100%">
    <tr class="netral">
        <td colspan="5"><bean:message key="label.tabel"/> <bean:message key="user.user"/></td>
    </tr>
    <tr class="header">
        <td><bean:message key="label.no"/></td>
        <td><bean:message key="user.userName"/></td>
        <td><bean:message key="user.nama"/></td>
        <td><bean:message key="user.departement"/></td>
        <td><bean:message key="label.action"/></td>
    </tr>
    <logic:notEmpty name="listUser">
        <c:forEach var="listUser" items="${listUser}" varStatus="row">
            <c:if test="${(row.count) % 2 == 0}"><tr class="over"></c:if>
            <c:if test="${(row.count) % 2 != 0}"><tr class="down"></c:if>
                <td width="5%"><c:out value="${row.count}"/></td>
                <td width="15%" align="left"><c:out value="${listUser.userId}"/></td>
                <td width="45%" align="left"><c:out value="${listUser.nama}"/></td>
                <td width="20%" align="left"><c:out value="${listUser.departement.namaBagian}"/></td>
                <td>
                    <html:link action="/user.do?action=userEdit" paramName="listUser" paramProperty="id" paramId="id" styleClass="noLink">[ <bean:message key="label.edit"/> ]</html:link>
                    <html:link action="/user.do?action=userDelete" paramName="listUser" paramProperty="id" paramId="id" styleClass="noLink">[ <bean:message key="label.delete"/> ]</html:link>
                </td>
            </tr>
        </c:forEach>
        <tr class="form">
            <td colspan="5">&nbsp;</td>
        </tr>
    </logic:notEmpty>
    <logic:empty name="listUser">
        <tr class="form">
            <td colspan="5" align="center"><bean:message key="user.user"/> <bean:message key="label.isEmpty"/></td>
        </tr>
    </logic:empty>
</table>